package dao.impl;

import org.hibernate.Session;
import org.hibernate.SessionFactory;

import dao.BaseDao;
import util.HibernateUtil;

public class BaseDaoImpl<T,P> implements BaseDao<T,P> {
	private Session session;
	private void openSession(){
		SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
		session = sessionFactory.openSession();
	}
	public String save(T t) {
		try{
			openSession();
			session.beginTransaction();
			session.save(t);
			session.getTransaction().commit();
			return "heheda";
		}finally{
			session.close();
		}
	}

	public String deleteById(String id) {
		// TODO Auto-generated method stub
		return null;
	}

	public String update(T t) {
		// TODO Auto-generated method stub
		return null;
	}

	public String getById(String id) {
		// TODO Auto-generated method stub
		return null;
	}

}
